<?php
namespace app\user\event\listeners\user;

use think\facade\Event;
use app\common\event\subscribes\notify\Notify;
use app\user\logic\user\Account;

/**
 * 注册通知
 */
class RegNotify
{
    public static function handle(Account $user)
    {
        // 参数
        $mid = $user->id;
        if ( !$mid ) return;

        $param = [
            'user' => $mid,
            'type' => 'system_notify',
            'key'  => 'register',
            'var'  => [
                'user_name' => $user->nick_name,
            ],
        ];

        Event::subscribe(Notify::class);
        Event::trigger('Notify', $param);
    }
}
